It looks like this was a user error on my apart, abetted by an apparent bug in symbol-reference autocompletion.
I had completely forgotten that the parameter naming rules for subscripts are different than for functions: subscript parameters don't take a label in the call unless you explicitly specify both a label and a local name in the declaration. So the type of the subscript declared
public subscript(_ date: String, visit: CaseID) -> ValueOrMessage<Meeting> { ... }
really is subscript(_:_:). not subscript(_:visit:). That explains why explicitly using the (::) worked. But it doesn't explain why the editor autocompletion wanted to give me (_:visit:). Anyway, changing the code declaration to
public subscript(_ date: String, visit visit: CaseID) -> ValueOrMessage<Meeting> { ... }
made the subscript work the way I expected, and made autocompletion work, too.
BUT ...
Roughly the same problem shows up with operator functions, and in this case, it looks like it may really be a DocC bug.
Consider
public static func ==(_ lhs: Meeting.Item, _ rhs: Meeting.Item) -> Bool {...}
public static func <(_ lhs: Meeting.Item, _ rhs: Meeting.Item) -> Bool {...}
and, in the documentation extension file,
- ``<(_:_:)``
- ``==(_:_:)``
The equality declaration reference works as expected, and the apparently identical less-than declaration fails. In the Swift source, I get the diagnostic “Topic reference '%3C(%3A%3A)' couldn't be resolved. No local documentation matches this reference.” and in the documentation page the equality function shows up in my Ordering section, but the less-than function shows up in the auto-created Operators section.
Topic:
Programming Languages
SubTopic:
Swift
Tags: